<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tail log</title>

<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/bootstrap-table.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>
<!-- Latest compiled and minified Locales -->
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.12.1/locale/bootstrap-table-zh-CN.min.js"></script>

<style>
html, body {
	height: 100%;
	width: 100%;
}

.content{
  word-break: break-all;
  word-wrap: break-word;
}
</style>
</head>
<body>
	<div class="container-fluid">
		<table id="logTable"></table>
	</div>
<!-- 	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> -->
<!-- 		<div class="modal-dialog modal-lg" role="document" style="width:90%"> -->
<!-- 			<div class="modal-content"> -->
<!-- 				<div class="modal-header"> -->
<!-- 					<button type="button" class="close" data-dismiss="modal" aria-label="Close"> -->
<!-- 						<span aria-hidden="true">×</span> -->
<!-- 					</button> -->
<!-- 					<h4 class="modal-title" id="myModalLabel">日志详情</h4> -->
<!-- 				</div> -->
<!-- 				<div class="modal-body" id="myModalBody" style="width:100%;height:800px;overflow:auto;"> -->
<!-- 					<div class="jumbotron" id="content"> -->
					
<!-- 					</div> -->
<!-- 				</div> -->
<!-- 				<div class="modal-footer"> -->
<!-- 					<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button> -->
<!-- 				</div> -->
<!-- 			</div> -->
<!-- 		</div> -->
<!-- 	</div> -->
</body>
<script>
	
	function show(dom){
		var fileName =$(dom).text();
		location.href='../../dorado/logs/download/'+fileName;
	};
	
	$(document).ready(function() {
		
// 		$('#myModal').on('shown.bs.modal', function (e) { 
// 	        // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零  
// 	        $(this).css('display', 'block');  
// 	        var modalHeight=$(window).height() / 2 - $('#myModal .modal-dialog').height() / 2;  
// 	        $(this).find('.modal-dialog').css({  
// 	            'margin-top': modalHeight  
// 	        });  
// 	    }); 

// 		$('#myModal').on('hidden.bs.modal', function (e) {
// 			$('#content').empty();
// 	    }); 
// 		$('#myModal').on('hide.bs.modal', function (e) {
// 			$('#myModalBody').scrollTop(0);
// 	    }); 
		
		$('#logTable').bootstrapTable({
			url : '../../dorado/logs', //请求后台的URL（*）
			method : 'GET', //请求方式（*）
			toolbar : '#toolbar',
			buttonsAlign:'left',
			striped : true,
			cache : false,
			pagination : true,
			sortable : false,
			queryParamsType : '',
			queryParams : function(params) {
				return {
					pageSize : params.pageSize,
					pageIndex : params.pageNumber
				};
			},//传递参数（*）
			sidePagination : "server", //分页方式：client客户端分页，server服务端分页（*）
			pageNumber : 1, //初始化加载第一页，默认第一页
			pageSize : 20, //每页的记录行数（*）
			showRefresh : true,
			paginationLoop : false,
			cardView:false,
			paginationPreText : '上一页',
			paginationNextText : '下一页',
			paginationHAlign:'left',
			paginationDetailHAlign:'right',
			pageList:[ 10, 20 ,30 ], //可供选择的每页的行数（*）s
			columns : [
				{
				title : '编号',
				width:'5%',
				formatter : function(value, row, index) {
					return index + 1;
				}
			}, {
				field : 'fileName',
				title : '文件名',
				formatter: function (value) {
					return "<span data-toggle='tooltip'  data-original-title='点击下载文件' class='label label-primary' style='cursor:pointer' onClick='show(this)'>" + value + "</span>";
				}
			},
			{
				field : 'size',
				title : '文件大小'
			}, {
				field : 'lastModifiedTime',
				title : '最后修改日期'
			}, ],
			rowStyle : function(row, index) {
				var classesArr = [ '', '' ];
				var strclass = "";
				if (index % 2 === 0) {//偶数行
					strclass = classesArr[0];
				} else {//奇数行
					strclass = classesArr[1];
				}
				return {
					classes : strclass
				};
			},
			onLoadSuccess:function(data){
				$('span.label').tooltip({
					placement:'right',
					delay: { show: 500, hide: 100 }
				});
			}
		});
	});
</script>
</body>
</html>